package com.chenqi.controller;

import com.chenqi.model.entity.Billboard;
import com.chenqi.service.BillboardService;
import com.chenqi.utils.JsonData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 公告版控制器
 * @program: ardaicommunity
 * @author: ChenQi
 * @create: 2021-03-2021/3/7-08-39
 */
@RestController
@RequestMapping("/api/v1/billboard")
public class BillboardController extends BaseController {

    @Autowired
    private BillboardService billboardService;

    /**
     * 获取可展示公告的请求
     * @return
     */
    @GetMapping("/get")
    public JsonData getBillboard() {
        try {
            Billboard billboard = billboardService.getBillboard();
            return JsonData.BuildSuccess(billboard, "查询成功!");
        }catch (Exception e){
            return JsonData.BuildError("查询失败!");
        }
    }

}
